Data storage devices (e.g., disk drives or non-volatile semiconductor memories) may be employed as mass storage for a computer system (e.g., desktop, laptop, portable, etc.) or a consumer device (e.g., music player, cell phone, camera, etc.) or other suitable application. The data storage device includes a non-volatile memory (e.g., a disk or a semiconductor memory) for storing user data in memory segments which are accessed using an address translation layer. For example, the address translation layer may map a logical block address (LBA) received from a host to a physical block address (PBA) representing a memory segment of the non-volatile memory. The indirect mapping of LBA to PBA facilitates aspects such as defect mapping, and log-structured file systems where the LBA to PBA mapping may change over time.
An example data storage device employing an address translation layer is a non-volatile semiconductor memory comprising one or more memory devices (such as a flash memory). Each memory device typically comprises a number of blocks which are accessed a page at a time. For example, a single block may comprise 128 pages where each page comprises 4096 bytes. Since a page typically cannot be overwritten without first being erased, a new page in a different block is typically selected to perform an “overwrite” operation. Accordingly, the address translation layer must maintain the appropriate LBA to PBA mapping as each write operation changes the physical location of the user data (similar to a log-structured file system). When the same LBA is written by the host, the data is written to a new PBA and the old PBA is marked invalid so that it may be reused (erased and overwritten with new data).
A similar dynamic LBA to PBA mapping may be employed in a disk drive, wherein the memory segments comprise data sectors of data tracks which may or may not be erased before being overwritten. The process of copying data from valid memory segments to new memory segments and reallocating the invalid memory segments is referred to as garbage collection.